package com.metaverse.backend.douyin;

import com.metaverse.backend.dto.GiftAttribute;
import com.metaverse.backend.dto.RoomProgressUpdateDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.persistence.Transient;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * 房间信息
 */
@Data
@ApiModel("房间信息")
public class RoomDataDTO {

    @ApiModelProperty("房间id")
    private String roomId;

    @ApiModelProperty("局号")
    private String roundId;

//    @ApiModelProperty("游戏进度条")
//    private BigDecimal progress;

    @ApiModelProperty("阵营信息")
    private List<RoomProgressUpdateDTO> progress;

    @ApiModelProperty("当前时间戳")
    private long timestamp = System.currentTimeMillis();

    @ApiModelProperty("开播时间戳")
    private long startTime;

    @ApiModelProperty("结束时间")
    private long endTime;

    @ApiModelProperty("游戏是否结束")
    private boolean gameEnd = false;

    @ApiModelProperty("胜利结果，12阵营")
    private int victoryLocation;

    @Transient
    @ApiModelProperty("玩家数据，重连的时候才返回")
    private List<PlayerDataDTO> playerDataList = new ArrayList<>();

    @Transient
    @ApiModelProperty("推送消息数据，返回最新消息")
    private List<MsgDataDTO> msgDataList = new ArrayList<>();

//    @Transient
//    @ApiModelProperty("仙女棒等级配置")
//    private Map<String, GiftLevelAttribute> levelCongfig;

    @Transient
    @ApiModelProperty("礼物属性配置")
    private Map<String, GiftAttribute> giftGiftAttributeCongfig;


    @ApiModelProperty("积分池")
    private BigDecimal scorePool = BigDecimal.ZERO;


    public boolean hasMsg() {
        if (this.playerDataList != null && this.playerDataList.size() > 0) {
            return true;
        }

        if (this.msgDataList != null && this.msgDataList.size() > 0) {
            return true;
        }

        return false;
    }


}
